﻿namespace WayneGameSolution.Communicate
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using WayneGameSolution.Membership;
    using WayneGameSolution.Packs;

    public abstract class Link : ILink
    {

        #region ILink Members

        abstract public event PackReceivedEventHandler PackReceived;

        abstract public event EventHandler PackSent;

    abstract public event EventHandler LinkClosing;

    abstract public event EventHandler LinkClosed;

        abstract public void Close();

 

    

        abstract public void SendPack(IEnumerable<IDataPack> packs);


        abstract public void SendPack(params IDataPack[] packs);
 

        public ICrypt Cryptography
        {
             get;
             set;
        }

        public int InboxCount
        {
            get;
            protected set;
        }

        public DateTime LastDataTime
        {
            get;
            protected set;
        }

        public int OutboxCount
        {
            get;
            protected set;
        }

        public ICodec PackCodec
        {
            get;
            set;
        }

        public LinkStatus Status
        {
            get;
            set;
        }

        public int TimeoutSecond
        {
            get;
            protected set;
        }

        private int _PackIndex = 0;

        protected int PackIndex
        {
            get 
            {
                unchecked
                {
                    return _PackIndex++;
                    
                }
            }
        
        }

        #endregion



    }
}

